using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using CSP.Model.CSP;

namespace CSP.DataAccess.Mapping
{
    public class ServiceInfoServiceTypeRelMap : EntityTypeConfiguration<ServiceInfoServiceTypeRel>
    {
        public ServiceInfoServiceTypeRelMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            // Table & Column Mappings
            this.ToTable("ServiceInfoServiceTypeRel");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.ServiceTypeId).HasColumnName("ServiceTypeId");
            this.Property(t => t.ServiceInfoId).HasColumnName("ServiceInfoId");

            // Relationships
            this.HasRequired(t => t.ServiceInfo)
                .WithMany(t => t.ServiceInfoServiceTypeRels)
                .HasForeignKey(d => d.ServiceInfoId);
            this.HasRequired(t => t.ServiceType)
                .WithMany(t => t.ServiceInfoServiceTypeRels)
                .HasForeignKey(d => d.ServiceTypeId);

        }
    }
}
